#ifndef DEFINITIONS_H
#define	DEFINITIONS_H
#include <cyg/hal/hal_arch.h>
#include "var_io.h"


//Stack and thread definitions
#define MDM_PRIOR		14
#define HOBB_PRIOR		15
#define LED_PRIOR		16
#define INIT_PRIOR		17
#define SYSMON_PRIOR	18
#define CFG_PRIOR		20
#define WD_PRIOR		24
#define TERM_PRIOR		25


//Stack thread sizes
#define INIT_STACK_SIZE		CYGNUM_HAL_STACK_SIZE_TYPICAL*4
#define TERM_STACK_SIZE		CYGNUM_HAL_STACK_SIZE_TYPICAL*4
#define CFG_STACK_SIZE		CYGNUM_HAL_STACK_SIZE_TYPICAL*2
#define MDM_STACK_SIZE		CYGNUM_HAL_STACK_SIZE_TYPICAL*3
#define HOBB_STACK_SIZE		CYGNUM_HAL_STACK_SIZE_TYPICAL
#define SYSMON_STACK_SIZE	CYGNUM_HAL_STACK_SIZE_TYPICAL*4
#define LED_STACK_SIZE		CYGNUM_HAL_STACK_SIZE_TYPICAL
#define WD_STACK_SIZE		CYGNUM_HAL_STACK_SIZE_TYPICAL


//Test points
#define TP2            CYGHWR_HAL_STM32_GPIO( C,12, OUT_2MHZ , GPOOD)
#define TP1            CYGHWR_HAL_STM32_GPIO( D, 4, OUT_2MHZ , GPOOD)

//Discrete inputs
#define DISC_IN1	CYGHWR_HAL_STM32_GPIO( D, 9, IN , PULLUP)
#define DISC_IN2	CYGHWR_HAL_STM32_GPIO( D, 8, IN , PULLUP)

//Analog inputs
#define ANA_IN1		CYGHWR_HAL_STM32_GPIO( C, 5, IN , ANALOG)
#define ANA_IN2		CYGHWR_HAL_STM32_GPIO( B, 0, IN , ANALOG)
#define ANA_IN3		CYGHWR_HAL_STM32_GPIO( B, 1, IN , ANALOG)
#define ANA_IN4		CYGHWR_HAL_STM32_GPIO( C, 4, IN , ANALOG)

//LED DEM0
//#define LED_R		CYGHWR_HAL_STM32_GPIO( C, 0, OUT_2MHZ , GPOPP)
//#define LED_G		CYGHWR_HAL_STM32_GPIO( C, 1, OUT_2MHZ , GPOPP)
//LED ISS1
#define LED_R		CYGHWR_HAL_STM32_GPIO( E, 3, OUT_2MHZ , GPOPP)
#define LED_G		CYGHWR_HAL_STM32_GPIO( E, 2, OUT_2MHZ , GPOPP)


//I2C BUS
#define I2C_SCL CYGHWR_HAL_STM32_GPIO( B, 6,  OUT_2MHZ, ALT_OPENDRAIN)
#define I2C_SDA CYGHWR_HAL_STM32_GPIO( B, 7, OUT_2MHZ , ALT_OPENDRAIN)

//SIMCOM Modem
#define SERIAL_SIMCOM_DEVICE "/dev/tty1"
#define SERIAL_SIMCOM_TX	CYGHWR_HAL_STM32_GPIO( A, 2, OUT_2MHZ , ALT_PUSHPULL)
#define SERIAL_SIMCOM_RX	CYGHWR_HAL_STM32_GPIO( A, 3, IN , PULLUP)
#define SIMCOM_PWR_KEY		CYGHWR_HAL_STM32_GPIO( B, 11, OUT_2MHZ , GPOPP)
#define MDM_PWR_OFF			CYGHWR_HAL_STM32_GPIO( A, 1, OUT_2MHZ , GPOPP)

//CONFIG
#define SERIAL_CONFIG_DEVICE "/dev/tty3"
#define SERIAL_CONFIG_TX	CYGHWR_HAL_STM32_GPIO( C, 10, OUT_2MHZ , ALT_PUSHPULL)
#define SERIAL_CONFIG_RX	CYGHWR_HAL_STM32_GPIO( C, 11, IN , PULLUP)


#endif	/* DEFINITIONS_H */

